.\"
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
.\" permission to reproduce portions of its copyrighted documentation.
.\" Original documentation from The Open Group can be obtained online at
.\" http://www.opengroup.org/bookstore/.
.\"
.\" The Institute of Electrical and Electronics Engineers and The Open
.\" Group, have given us permission to reprint portions of their
.\" documentation.
.\"
.\" In the following statement, the phrase ``this text'' refers to portions
.\" of the system documentation.
.\"
.\" Portions of this text are reprinted and reproduced in electronic form
.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
.\" Standard for Information Technology -- Portable Operating System
.\" Interface (POSIX), The Open Group Base Specifications Issue 6,
.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
.\" Engineers, Inc and The Open Group.  In the event of any discrepancy
.\" between these versions and the original IEEE and The Open Group
.\" Standard, the original IEEE and The Open Group Standard is the referee
.\" document.  The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
.\" This notice shall appear on any product containing this material.
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\"
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
.\" Copyright (c) 1995, Sun Microsystems, Inc.  All Rights Reserved.
.\"
.TH GENCAT 1 "Feb 1, 1995"
.SH NAME
gencat \- generate a formatted message catalog
.SH SYNOPSIS
.LP
.nf
\fBgencat\fR \fIcatfile\fR \fImsgfile\fR...
.fi

.SH DESCRIPTION
.sp
.LP
The \fBgencat\fR command merges the message text source file(s) \fImsgfile\fR
into a formatted message database \fIcatfile\fR. The database \fIcatfile\fR is
created if it does not already exist.  If \fIcatfile\fR does exist, its
messages are included in the new \fIcatfile\fR. If set and message numbers
collide, the new message-text defined in \fImsgfile\fR replaces the old message
text currently contained in \fIcatfile\fR. The message text source file (or set
of files) input to \fBgencat\fR can contain either set and message numbers or
simply message numbers, in which case the set \fBNL_SETD\fR (see
\fBnl_types.h\fR(3HEAD)) is assumed.
.SS "Message Text Source File Format"
.sp
.LP
The format of a message text source file is defined as follows. Note that the
fields of a message text source line are separated by a single \fBASCII\fR
space or tab character. Any other \fBASCII\fR spaces or tabs are considered as
part of the subsequent field.
.sp
.ne 2
.na
\fB\fB$set\fR \fIn comment\fR \fR
.ad
.RS 22n
Where \fIn\fR specifies the set identifier of the following messages until the
next \fB$set\fR, \fB$delset\fR, or end-of-file appears. \fIn\fR must be a
number in the range (\fB1\fR-{\fBNL_SETMAX\fR}). Set identifiers within a
single source file need not be contiguous. Any string following the set
identifier is treated as a comment.  If no \fB$set\fR directive is specified in
a message text source file, all messages are located in the default message set
\fBNL_SETD\fR.
.RE

.sp
.ne 2
.na
\fB\fB$delset\fR \fIn comment\fR \fR
.ad
.RS 22n
Deletes message set \fIn\fR from an existing message catalog. Any string
following the set number is treated as a comment. (\fBNote:\fR if  \fIn\fR is
not a valid set it is ignored.)
.RE

.sp
.ne 2
.na
\fB\fB$\fR\fIcomment\fR \fR
.ad
.RS 22n
A line beginning with a dollar symbol  \fB$\fR followed by an \fBASCII\fR space
or tab character is treated as a comment.
.RE

.sp
.ne 2
.na
\fB\fIm\fR \fImessage-text\fR \fR
.ad
.RS 22n
The \fIm\fR denotes the message identifier, a number in the range
(\fB1\fR-{\fBNL_MSGMAX\fR}).  The \fImessage-text\fR is stored in the message
catalog with the set identifier specified by the last \fB$set\fR directive, and
with message identifier \fIm\fR. If the \fImessage-text\fR is empty, and an
\fBASCII\fR space or tab field separator is present, an empty string is stored
in the message catalog.  If a message source line has a message number, but
neither a field separator nor \fImessage-text\fR, the existing message with
that number (if any) is deleted from the catalog. Message identifiers need not
be contiguous.  The length of \fImessage-text\fR must be in the range
(\fB0\fR-{\fBNL_TEXTMAX\fR}).
.RE

.sp
.ne 2
.na
\fB\fB$quote\fR \fIc\fR \fR
.ad
.RS 22n
This line specifies an optional quote character \fIc\fR, which can be used to
surround \fImessage-text\fR so that trailing spaces or null (empty) messages
are visible in a message source line.  By default, or if an empty \fB$quote\fR
directive is supplied, no quoting of \fImessage-text\fR will be recognized.
.RE

.sp
.LP
Empty lines in a message text source file are ignored.
.sp
.LP
Text strings can contain the special characters and escape sequences defined in
the following table:
.sp

.sp
.TS
box;
l l l
l l l .
Description	Symbol	Sequence
newline	NL(LF)	\en
horizontal tab	HT	\et
vertical tab	VT	\ev
backspace	BS	\eb
carriage return	CR	\er
form feed	FF 	\ef
backslash	\e	\e\e
bit pattern	ddd	\eddd
.TE

.sp
.LP
The escape sequence \fB\e\fR\fIddd\fR consists of backslash followed by 1, 2 or
3 octal digits, which are taken to specify the value of the desired character.
If the character following a backslash is not one of those specified, the
backslash is ignored.
.sp
.LP
Backslash followed by an \fBASCII\fR newline character is also used to continue
a string on the following line. Thus, the following two lines describe a single
message string:
.sp
.in +2
.nf
1 This line continues \e
to the next line
.fi
.in -2

.sp
.LP
which is equivalent to:
.sp
.in +2
.nf
    1 This line continues to the next line
.fi
.in -2

.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.na
\fB\fIcatfile\fR \fR
.ad
.RS 12n
A path name of the formatted message catalog. If \(mi is specified, standard
output is used.
.RE

.sp
.ne 2
.na
\fB\fImsgfile\fR \fR
.ad
.RS 12n
A path name of a message text source file. If \(mi is specified for an instance
of \fImsgfile\fR, standard input is used. The format of message text source
files is defined in \fBMessage Text Source File Format\fR.
.RE

.SH ENVIRONMENT VARIABLES
.sp
.LP
See \fBenviron\fR(7) for descriptions of the following environment variables
that affect the execution of \fBgencat\fR: \fBLANG\fR, \fBLC_ALL\fR,
\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR \fR
.ad
.RS 7n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB>0\fR \fR
.ad
.RS 7n
An error occurred.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
CSI	enabled
_
Interface Stability	Standard
.TE

.SH SEE ALSO
.sp
.LP
.BR mkmsgs (1),
.BR catgets (3C),
.BR catopen (3C),
.BR gettxt (3C),
.BR nl_types.h (3HEAD),
.BR attributes (7),
.BR environ (7),
.BR standards (7)
